import { User } from "./search-panel";
import React, { useEffect } from "react";
import { useAsync, cleanObject } from "utils/index";
import { getUsers } from "service/login";
export const useUsers = (param?: Partial<User>) => {
  const { run, ...result } = useAsync<User[] | any>();

  useEffect(() => {
    run(getUsers(cleanObject(param || {}), "all"));
  }, [param, getUsers, cleanObject]);
  return result;
};
